;;====================================================================
;; classes.lisp
;;
;; class definitions of :roll/gui package.
;; In this class definitions, we use defclass* of :roll/util package
;;                               written by R.Ueda(garaemon@gmail.net)
;;====================================================================
(declaim (optimize (debug 3) (safety 3)))

(in-package #:roll/gui)

(defclass* <manager>
    ()
  ((windows nil)
   (display nil)
   (root-screen nil)
   (root-window nil)
   (event-thread nil)
   (logger nil)
   (mutex (roll/util:make-mutex))))

(defclass* <window>
    ()
  ((width nil)
   (height nil)
   (name "")
   (image nil)                     ;instance of <image>
   (image-array nil)               ;simple array of (unsigned 8). #1A.
   (gcontext nil)
   (manager nil)
   (xwindow nil)                        ;for x window
   (x nil)
   (y nil)
   (widgets nil)                        ;the list of <widgets>
   ))

(defclass* <image>
    ()
  ((width nil)
   (height nil)
   (depth nil)
   (content nil)
   (foreground nil)
   (background nil)
   (font-loader nil)))

;; <packing-box> classes

(defclass* <packing-box>
    ()
  ((boxes nil)
   (window nil)
   (root-packing-box nil)
   (widgets nil)))

(defclass* <vertical-packing-box>
    (<packing-box>)
  ())

(defclass* <horizontal-packing-box>
    (<packing-box>)
  ())

;; <widget> classes

(defclass* <widget>
    (<window>)
  ((parent nil)
   (debugp nil))
  (:documentation
   "There are some limitations in <widget>
    
    -- widget must be a rectangle."
   ))

(defclass* <button-widget>
    (<widget>)
  ((button-state nil)
   (button-region nil))
  )

(defclass* <toggle-button-widget>
    (<button-widget>)
  ((display-string "")
   (display-string-offset nil)
   (font-size nil))
  (:documentation
   "widget class for a toggle button.
    +-------------+
    |<--> offset  |
    | x    hoge   |
    +-------------+
   "))

(defclass* <click-button-widget>
    (<button-widget>)
  ((display-string "")
   (press-callback nil)
   (display-string-margin nil)
   (font-size nil))
  (:documentation
   "just a simple button.

   When button pressed, call press-callback function.")
  )

(defclass* <canvas>
    (<widget>)
  ()
  (:documentation
   "<canvas> class is a ..."))

(defclass* <gl-canvas>
    (<canvas>)
  ((gl-context nil)
   (default-gl-line-width 2.0))
  (:documentation
   ""))
